package com.lxh.baselibray.util;

import android.os.Bundle;

import com.alibaba.android.arouter.launcher.ARouter;
import com.lxh.baselibray.base.XActivity;
import com.lxh.baselibray.base.XFragment;


/**
 * Describe：ARouter帮助类
 *
 */

public class ARouterUtils {


    /**
     * 根据path返回Fragment
     *
     * @param path path
     * @return fragment
     */
    public static XFragment getFragment(String path) {
        return (XFragment) ARouter.getInstance()
                .build(path)
                .navigation();
    }

    /**
     * 根据path返回Activity
     *
     * @param path path
     * @return Activity
     */
    public static XActivity getActivity(String path) {
        return (XActivity) ARouter.getInstance()
                .build(path)
                .navigation();
    }

    public static void jump(String path){
        ARouter.getInstance().build(path).navigation();
    }

    public static void jump(String path, Bundle bundle){
        ARouter.getInstance().build(path).with(bundle).navigation();
    }
}
